<?php

namespace app\common\controller;

use think\Controller;
use think\Request;
use think\View;

class Base extends Controller
{
    public function __construct()
    {
        $this->request = new Request();
        echo "<pre>";
        var_dump(View::class);
        echo "</pre>";
        die;
        $this->app->view->assign("nav",$this->getNavs($this->request->request("s")));
    }
    /**
     * 显示资源列表
     *
     * @return \think\Response
     */
    public function index()
    {
        //
    }

    public function getNavs($value = '')
    {
        $nav = [
            [
                "name" => "首页",
                "url" => ','
            ],
            [
                "name" => "题库",
                "url" => '/index/questions'
            ],
            [
                "name" => "测验",
                "url" => '/index/tests'
            ],
        ];
        foreach ($nav as &$item){
            if($item["url"] == $value){
                $item["action"] = true;
            }
        }
        return $nav;
    }
}
